package hotgammon.alphamon;

import hotgammon.common.Game;
import hotgammon.common.Location;
import hotgammon.common.ValidatorStrategy;

public class AlphaValidatorStrategy implements ValidatorStrategy {

	@Override
	public boolean isValid(Location from, Location to, int diceValue, Game game) {

        if (to == Location.B_BAR || to == Location.R_BAR // Trying to move to places we don't support
            || to == Location.R_BEAR_OFF || to == Location.B_BEAR_OFF) {
                return false;
            }
        if (game.getColor(to) != game.getPlayerInTurn() && game.getCount(to) > 0) return false; // Trying to move to a location occupied by the opponent
        
        return true;
	}
	
}
